package cn.com.headfree.workflowant.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import cn.com.headfree.vo.workflow.TBusinessWorkflowBindVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gta.edu.sdk.common.dto.Page;
import com.gta.edu.sdk.util.StringUtil;

import cn.com.headfree.base.controller.ExBaseController;
import cn.com.headfree.base.controller.ResultData;
import cn.com.headfree.entity.TBusinessWorkflowBind;
import cn.com.headfree.entity.TMouldInfo;
import cn.com.headfree.entity.TOrgDept;
import cn.com.headfree.entity.isc.User;
import cn.com.headfree.vo.workflow.ProcessListVo;
import cn.com.headfree.workflowant.dto.ApproveWorkFlowDto;
import cn.com.headfree.workflowant.service.IWorkFlowAntService;

/**
 * @Title  WorkFlowAntController.java
 * @Package cn.com.headfree.workflowant.controller
 * @Description 流程controller
 * @author yangwang
 * @date  2020年7月29日 下午5:39:17
 */
@Controller
@RequestMapping(value = "/workFlowAnt", produces = "application/json;charset=UTF-8")
public class WorkFlowAntController extends ExBaseController {
	private static final Logger LOG = LogManager.getLogger(WorkFlowAntController.class);

    @Autowired
    private IWorkFlowAntService workFlowAntService;

    /**
	 * 获取所有一级单位
	 * @author yangwang
	 * @return  List<TOrgDept>
	 *  */
    @RequestMapping(value = "/getWorkFlowUnits")
	@ResponseBody
	public ResultData getWorkFlowUnits(){
		ResultData result = new ResultData();;
		try {
			List<TOrgDept> list = workFlowAntService.getWorkFlowUnits();
			result.setData(list);
			LOG.info("获取所有一级单位成功");
		} catch(Exception e) {
			LOG.error("获取所有一级单位异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取所有一级单位异常");
		}
		return result;
    }

    /**
	 * @description 获取所有业务类型
	 * @author yangwang
	 * @date 20200729 14:48
	 * @return JSONArray
	 */
	@RequestMapping(value = "/getMouldInfoList")
	@ResponseBody
	public ResultData getMouldInfoList() {
		ResultData result = new ResultData();
		try {
			List<TMouldInfo> list = workFlowAntService.getMouldInfoList();
			result.setData(list);
			LOG.info("获取所有业务类型成功");
		} catch(Exception e) {
			LOG.error("获取所有业务类型异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取所有业务类型异常");
		}
		return result;
	}

	@RequestMapping(value = "/getAllMouldInfoList")
	@ResponseBody
	public ResultData getAllMouldInfoList() {
		ResultData result = new ResultData();
		try {
			result.setData(workFlowAntService.getMouldInfoList());
			LOG.info("获取所有业务类型成功");
		} catch(Exception e) {
			LOG.error("获取所有业务类型异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取所有业务类型异常");
		}
		return result;
	}

	/**
	 * @description 获取当前人待办/已办业务类型
	 * @author yangwang
	 * @date 20200729 14:48
	 * @param request
	 * @param process (flowStatus:0-待审核,1-通过,2-不通过,3-驳回，-1-全部)
	 * @return ResultData
	 */
	@RequestMapping(value = "/getMouldsOfUser")
	@ResponseBody
	public ResultData getMouldsOfUser(HttpServletRequest request,ProcessListVo process) {
		ResultData result = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				process.setDealErpNo(user.getFax());
				result.setData(workFlowAntService.getMouldsOfUser(process));
				LOG.info("获取业务类型成功");
			}else {
				LOG.error("获取业务类型异常");
				result.setSuccess(false);
				result.setErrorMsg("获取业务类型异常");
			}
		} catch(Exception e) {
			LOG.error("获取业务类型异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取业务类型异常");
		}

		return result;
	}

	@RequestMapping(value = "/getMouldsOfUserDing")
	@ResponseBody
	public ResultData getMouldsOfUserDing(HttpServletRequest request,@RequestBody ProcessListVo process) {
		ResultData result = new ResultData();
		try {
			LOG.info("========================进入getMouldsOfUserDing方法...");
			LOG.info("========================process.getDealErpNo()="+process.getDealErpNo());
//			User user = this.getLoginUserInfo(request);
			if(!StringUtil.isNullOrEmpty(process.getDealErpNo())) {
//				process.setDealErpNo(user.getFax());
				result.setData(workFlowAntService.getMouldsOfUser(process));
				LOG.info("获取业务类型成功");
			}else {
				LOG.error("获取业务类型异常");
				result.setSuccess(false);
				result.setErrorMsg("获取业务类型异常");
			}
		} catch(Exception e) {
			LOG.error("获取业务类型异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取业务类型异常");
		}

		return result;
	}

    /**
	 * @description 根据业务编号获取系统配置的工作流模板
	 * @author yangwang
	 * @date 20200729 14:48
	 * @return JSONArray
	 */
	@RequestMapping(value = "/getWorkFlowTemplates")
	@ResponseBody
	public ResultData getWorkFlowTemplates(HttpServletRequest request) {
		ResultData result =  new ResultData();
		User user = this.getLoginUserInfo(request);
		try {
			result = workFlowAntService.getWorkFlowTemplates(user.getBaseOrgId());
			LOG.info("获取系统配置的工作流模板成功");
		} catch(Exception e) {
			LOG.error("获取系统配置的工作流模板出现异常", e);
			result.setSuccess(false);
			result.setErrorMsg("获取系统配置的工作流模板出现异常");
		}
		return result;
	}

	/**
	 * @description 业务类型绑定流程
	 * @author yangwang
	 * @date 20200729 14:48
	 * @param deptId 单位id
	 * @param moduleId 类型id
	 * @param workFlowId 流程id
	 * @return ResultData
	 */
	@RequestMapping(value = "/bindWorkFlowId/{deptId}/{moduleId}/{workFlowId}")
	@ResponseBody
	public ResultData bindWorkFlowId(@PathVariable("deptId") String deptId,@PathVariable("moduleId") String moduleId,@PathVariable("workFlowId") String workFlowId) {
		ResultData resultData = new ResultData();
		try {
			TBusinessWorkflowBind bind = new TBusinessWorkflowBind();
			bind.setOrgId(deptId);
			bind.setBusinessTypeId(moduleId);
			bind.setFlowId(workFlowId);
			workFlowAntService.updateWorkFlowBind(bind);
			LOG.info("业务类型绑定流程成功");
		} catch(Exception e) {
			LOG.error("业务类型绑定流程异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("业务类型绑定流程异常");
		}
		return resultData;
	}

	/**业务流程列表
	 * @description
	 * @return ResultData
	 */
	@RequestMapping(value = "/businessWorkflowBindList")
	@ResponseBody
	public ResultData getAllBusinessWorkflowBind(HttpServletRequest request,Page<TBusinessWorkflowBindVO> page, @RequestBody TBusinessWorkflowBindVO vo) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((("2").equals(user.getRemark()) || ("3").equals(user.getRemark()))) {
				workFlowAntService.getAllBusinessWorkflowBind(page, vo);
				resultData.setData(page);
				LOG.info("获取业务流程列表数据成功");
			}else{
				resultData.setSuccess(false);
				resultData.setErrorMsg("只能管理员操作");
			}
		} catch (Exception e) {
			LOG.error("获取业务流程列表数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取业务流程列表数据异常");
		}
		return resultData;
	}

	/**
	 * @description 业务流程列表
	 * @return ResultData
	 */
	@RequestMapping(value = "/deletebusinessWorkflowBindList")
	@ResponseBody
	public ResultData getAllBusinessWorkflowBind(HttpServletRequest request,@RequestBody TBusinessWorkflowBind businessWorkflowBind) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((("2").equals(user.getRemark()) || ("3").equals(user.getRemark()))){
				workFlowAntService.deleteBusinessWorkflowBind(businessWorkflowBind.getId());
				LOG.info("删除业务流程列表数据成功");
			}else{
				resultData.setSuccess(false);
				resultData.setErrorMsg("只能管理员操作");
			}
		} catch (Exception e) {
			LOG.error("获取业务流程列表数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取业务流程列表数据异常");
		}
		return resultData;
	}

	/**
	 * 获取待办业务流程数据
	 * @author yangwang
	 * @param page 分页参数
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getWaitApproveWorkFlows")
	@ResponseBody
	public ResultData getWaitApproveWorkFlows(HttpServletRequest request,Page<ApproveWorkFlowDto> page,@RequestBody ApproveWorkFlowDto approveWorkFlowDto) {
		ResultData resultData = new ResultData();
		try {
			resultData = workFlowAntService.getWaitApproveWorkFlowsNew(page, this.getLoginUserInfo(request),approveWorkFlowDto);
//			resultData = workFlowAntService.getWaitApproveWorkFlows(page, this.getLoginUserInfo(request));
			LOG.info("获取待办业务流程数据成功");
		} catch(Exception e) {
			LOG.error("获取待办业务流程数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取待办业务流程数据异常");
		}
		return resultData;
	}

	/**
	 * 获取待办业务流程数据 user:统一权限用户
	 * @author yangwang
	 * @param page 分页参数
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getWaitApproveWorkFlowsDing")
	@ResponseBody
	public ResultData getWaitApproveWorkFlowsDing(HttpServletRequest request,Page<ApproveWorkFlowDto> page,String iscUserId,String iscBaseOrgId,@RequestBody ApproveWorkFlowDto approveWorkFlowDto) {
		ResultData resultData = new ResultData();
		try {
			User user=new User();
			user.setId(iscUserId);
			user.setBaseOrgId(iscBaseOrgId);
			resultData = workFlowAntService.getWaitApproveWorkFlowsNew(page, user,approveWorkFlowDto);
//			resultData = workFlowAntService.getWaitApproveWorkFlows(page, user);
			LOG.info("获取待办业务流程数据成功");
		} catch(Exception e) {
			LOG.error("获取待办业务流程数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取待办业务流程数据异常");
		}
		return resultData;
	}

	/**
	 * 获取已办业务流程数据
	 * @author yangwang
	 * @param page 分页参数
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getDoneApproveWorkFlows")
	@ResponseBody
	public ResultData getDoneApproveWorkFlows(HttpServletRequest request,Page<ApproveWorkFlowDto> page,@RequestBody ApproveWorkFlowDto approveWorkFlowDto) {
		ResultData resultData = new ResultData();
		try {
			resultData = workFlowAntService.getDoneApproveWorkFlowsNew(page, this.getLoginUserInfo(request),approveWorkFlowDto);
//			resultData = workFlowAntService.getDoneApproveWorkFlows(page, this.getLoginUserInfo(request));
			LOG.info("获取已办业务流程数据成功");
		} catch(Exception e) {
			LOG.error("获取已办业务流程数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取已办业务流程数据异常");
		}
		return resultData;
	}

	/**
	 * 获取已办业务流程数据 user : 统一权限用户
	 * @author yangwang
	 * @param page 分页参数
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getDoneApproveWorkFlowsDing")
	@ResponseBody
	public ResultData getDoneApproveWorkFlowsDing(HttpServletRequest request,Page<ApproveWorkFlowDto> page,String iscUserId,String iscBaseOrgId,@RequestBody ApproveWorkFlowDto approveWorkFlowDto) {
		ResultData resultData = new ResultData();
		try {
			User user=new User();
			user.setId(iscUserId);
			user.setBaseOrgId(iscBaseOrgId);
//			resultData = workFlowAntService.getDoneApproveWorkFlows(page, user);
			resultData = workFlowAntService.getDoneApproveWorkFlowsNew(page, user,approveWorkFlowDto);
			LOG.info("获取已办业务流程数据成功");
		} catch(Exception e) {
			LOG.error("获取已办业务流程数据异常",e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取已办业务流程数据异常");
		}
		return resultData;
	}

	/**
	 * 获取下一审批节点数据(按钮)
	 * @author yangwang
	 * @param approveId 审批id
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getNextWorkFlowConditions")
	@ResponseBody
	public ResultData getNextWorkFlowConditions(String approveId) {
		ResultData resultData = new ResultData();
		try {
			resultData = workFlowAntService.getNextWorkFlowConditions(approveId);
			LOG.info("获取下一审批节点数据成功");
		} catch(Exception e) {
			LOG.error("获取下一审批节点数据异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取下一审批节点数据异常");
		}
		return resultData;
	}


	/**
	 * 获取下一审批节点数据(按钮)
	 * @author yangwang
	 * @param approveId 审批id
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/getNextWorkFlowConditionsDing")
	@ResponseBody
	public ResultData getNextWorkFlowConditionsDing(String approveId) {
		ResultData resultData = new ResultData();
		try {
			LOG.info("============================成功进入human-manage的getNextWorkFlowConditionsDing方法============================");
			resultData = workFlowAntService.getNextWorkFlowConditions(approveId);
			LOG.info("获取下一审批节点数据成功");
		} catch(Exception e) {
			LOG.error("获取下一审批节点数据异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取下一审批节点数据异常");
		}
		return resultData;
	}

	/**
	 * 审批业务流程
	 * @author yangwang
	 * @param flowDto businessTypeId 业务类型id
	 * @param flowDto businessId 业务id
	 * @param flowDto approveId 审批节点id
	 * @param flowDto approveResult 审批状态(1-通过,2-不通过)
	 * @param flowDto approveAdvise 审批意见
	 * @param flowDto approveCondition 审批条件
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/approveWorkFlow")
	@ResponseBody
	public ResultData approveWorkFlow(HttpServletRequest request,@RequestBody ApproveWorkFlowDto flowDto) {
		ResultData resultData = new ResultData();
		try {
			if(null != flowDto) {
				if(StringUtils.isNotBlank(flowDto.getBusinessId())) {
					if(StringUtils.isNotBlank(flowDto.getApproveId())) {
						User user = this.getLoginUserInfo(request);
						if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
							flowDto.setCurrentLoginErpNo(user.getFax());
							flowDto.setIscUserId(user.getId());
							flowDto.setUserName(user.getName());
							workFlowAntService.approveWorkFlow(user, flowDto);
							LOG.info("审批业务流程成功");
						}else {
							LOG.error("获取统一权限用户信息异常");
							resultData.setSuccess(false);
							resultData.setErrorMsg("获取统一权限用户信息异常");
						}
					}else {
						LOG.error("审批节点approveId不可为空");
						resultData.setSuccess(false);
						resultData.setErrorMsg("审批节点approveId不可为空");
					}
				}else {
					LOG.error("业务businessId不可为空");
					resultData.setSuccess(false);
					resultData.setErrorMsg("业务businessId不可为空");
				}
			}else {
				LOG.error("必要参数不可为空");
				resultData.setSuccess(false);
				resultData.setErrorMsg("必要参数不可为空");
			}
		} catch(Exception e) {
			LOG.error("审批业务流程异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("审批业务流程异常");
		}
		return resultData;
	}



	/**
	 * 审批业务流程
	 * @author yangwang
	 * @param flowDto businessTypeId 业务类型id
	 * @param flowDto businessId 业务id
	 * @param flowDto approveId 审批节点id
	 * @param flowDto approveResult 审批状态(1-通过,2-不通过)
	 * @param flowDto approveAdvise 审批意见
	 * @param flowDto approveCondition 审批条件
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/approveWorkFlowDing")
	@ResponseBody
	public ResultData approveWorkFlowDing(HttpServletRequest request,@RequestBody ApproveWorkFlowDto flowDto,String iscUserId,String fax,String userName ) {
		ResultData resultData = new ResultData();
		try {
			LOG.info("=================成功进入human-manage的approveWorkFlowDing方法============");
			LOG.info("=============================iscUserId="+iscUserId+",fax="+fax+",userName="+userName);
			if(null != flowDto) {
				if(StringUtils.isNotBlank(flowDto.getBusinessId())) {
					if(StringUtils.isNotBlank(flowDto.getApproveId())) {
//						User user = this.getLoginUserInfo(request);
						User user =new User();
						user.setId(iscUserId);
						user.setName(userName);
						user.setFax(fax);
						if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
							flowDto.setCurrentLoginErpNo(user.getFax());
							flowDto.setIscUserId(user.getId());
							flowDto.setUserName(user.getName());
							workFlowAntService.approveWorkFlow(user, flowDto);
							LOG.info("审批业务流程成功");
						}else {
							LOG.error("获取统一权限用户信息异常");
							resultData.setSuccess(false);
							resultData.setErrorMsg("获取统一权限用户信息异常");
						}
					}else {
						LOG.error("审批节点approveId不可为空");
						resultData.setSuccess(false);
						resultData.setErrorMsg("审批节点approveId不可为空");
					}
				}else {
					LOG.error("业务businessId不可为空");
					resultData.setSuccess(false);
					resultData.setErrorMsg("业务businessId不可为空");
				}
			}else {
				LOG.error("必要参数不可为空");
				resultData.setSuccess(false);
				resultData.setErrorMsg("必要参数不可为空");
			}
		} catch(Exception e) {
			LOG.error("审批业务流程异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("审批业务流程异常");
		}
		return resultData;
	}

	/**
	 * 获取审核进度数据
	 * @author yangwang
	 * @param page 分页
	 * @param process 进度数据
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/approveProcessPage")
	@ResponseBody
	public ResultData approveProcessPage(HttpServletRequest request,Page<ProcessListVo> page,@RequestBody ProcessListVo process) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				if((null != process)&&(StringUtils.isNotBlank(process.getBusinessTypeId()))) {
					process.setDealErpNo(user.getFax());
					resultData = workFlowAntService.approveProcessPage(page, process,user);
					LOG.info("获取审核进度数据成功");
				}else{
					LOG.error("参数businessTypeId不可为空");
					resultData.setSuccess(false);
					resultData.setErrorMsg("参数businessTypeId不可为空");
				}
			}else {
				LOG.error("获取审核进度数据异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取审核进度数据异常");
			}
		} catch(Exception e) {
			LOG.error("获取审核进度数据异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取审核进度数据异常");
		}
		return resultData;
	}


	/**
	 * 获取审核进度数据
	 * @author yangwang
	 * @param page 分页
	 * @param process 进度数据
	 * @return ResultData
	 *  */
	@RequestMapping(value = "/approveProcessPageDing")
	@ResponseBody
	public ResultData approveProcessPageDing(HttpServletRequest request,Page<ProcessListVo> page,String iscUserId,String iscBaseOrgId,@RequestBody ProcessListVo process) {
		ResultData resultData = new ResultData();
		try {
			LOG.info("=======================进入approveProcessPageDing方法===========");
			LOG.info("=======================process.getDealErpNo()="+process.getDealErpNo());
			LOG.info("=======================iscUserId="+iscUserId);
			LOG.info("=======================iscBaseOrgId="+iscBaseOrgId);
//			User user = this.getLoginUserInfo(request);
			User user=new User();
			user.setBaseOrgId(iscBaseOrgId);
			user.setId(iscUserId);
			user.setFax(process.getDealErpNo());
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				if((null != process)&&(StringUtils.isNotBlank(process.getBusinessTypeId()))) {
//					process.setDealErpNo(user.getFax());
					resultData = workFlowAntService.approveProcessPage(page, process,user);
					LOG.info("获取审核进度数据成功");
				}else{
					LOG.error("参数businessTypeId不可为空");
					resultData.setSuccess(false);
					resultData.setErrorMsg("参数businessTypeId不可为空");
				}
			}else {
				LOG.error("获取审核进度数据异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取审核进度数据异常");
			}
		} catch(Exception e) {
			LOG.error("获取审核进度数据异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("获取审核进度数据异常");
		}
		return resultData;
	}

	/**
	 * 根据业务ID获取该业务的审批记录
	 * @author yangwang
	 * @param businessId 业务id
	 * @return ResultData
	 */
	@RequestMapping(value = "/findApprovedRecord")
	public ResultData findApprovedRecord(String businessId) {
		ResultData resultData = new ResultData();
		try {
			resultData = workFlowAntService.findApprovedRecord(businessId);
			LOG.info("根据业务ID获取该业务的审批记录成功");
		} catch(Exception e) {
			LOG.error("根据业务ID获取该业务的审批记录异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("根据业务ID获取该业务的审批记录异常");
		}
		return resultData;
	}

	/**
	 * 根据业务ID获取该业务的审批记录
	 * @author yangwang
	 * @param businessId 业务id
	 * @return ResultData
	 */
	@RequestMapping(value = "/findApprovedRecordDing")
	public ResultData findApprovedRecordDing(String businessId) {
		ResultData resultData = new ResultData();
		try {
			LOG.info("=========================成功进入human-manage的findApprovedRecordDing方法=========================");
			resultData = workFlowAntService.findApprovedRecord(businessId);
			LOG.info("根据业务ID获取该业务的审批记录成功");
		} catch(Exception e) {
			LOG.error("根据业务ID获取该业务的审批记录异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("根据业务ID获取该业务的审批记录异常");
		}
		return resultData;
	}

	/**
	 * 删除业务
	 * @author yangwang
	 * @param process businessId 业务id
	 * @param process businessTypeId 业务类型id
	 * @return ResultData
	 */
	@RequestMapping(value = "/deleteBusiness")
	public ResultData deleteBusiness(HttpServletRequest request,@RequestBody ProcessListVo process) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				resultData = workFlowAntService.deleteBusiness(user, process);
				LOG.info("删除业务成功");
			}else {
				LOG.error("获取登录用户信息异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取登录用户信息异常");
			}
		} catch(Exception e) {
			LOG.error("删除业务异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("删除业务异常");
		}
		return resultData;
	}


	/**
	 * 删除业务
	 * @author yangwang
	 * @param process businessId 业务id
	 * @param process businessTypeId 业务类型id
	 * @return ResultData
	 */
	@RequestMapping(value = "/deleteBusinessDing")
	public ResultData deleteBusinessDing(HttpServletRequest request,@RequestBody ProcessListVo process,String userName,String fax,String iscUserId) {
		ResultData resultData = new ResultData();
		try {
//			User user = this.getLoginUserInfo(request);
			User user=new User();
			user.setId(iscUserId);
			user.setName(userName);
			user.setFax(fax);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				resultData = workFlowAntService.deleteBusiness(user, process);
				LOG.info("删除业务成功");
			}else {
				LOG.error("获取登录用户信息异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取登录用户信息异常");
			}
		} catch(Exception e) {
			LOG.error("删除业务异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("删除业务异常");
		}
		return resultData;
	}


	/**
	 * 删除待审核数据
	 * @param request
	 * @param process businessId 业务id
	 * @param process businessTypeId 业务类型id
	 * @param process approveId 审批id
	 * @return
	 */
	@RequestMapping(value = "/deleteWaitApproveBusiness")
	public ResultData deleteWaitApproveBusiness(HttpServletRequest request,@RequestBody ApproveWorkFlowDto process) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				resultData = workFlowAntService.deleteWaitApproveBusiness(user, process);
				LOG.info("删除业务成功");
			}else {
				LOG.error("获取登录用户信息异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取登录用户信息异常");
			}
		} catch(Exception e) {
			LOG.error("删除业务异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("删除业务异常");
		}
		return resultData;
	}


	/**
	 * 删除进度查看待审核数据
	 * @param request
	 * @param process businessId 业务id
	 * @param process businessTypeId 业务类型id
	 * @return
	 */
	@RequestMapping(value = "/deleteProcessBusiness")
	public ResultData deleteProcessBusiness(HttpServletRequest request,@RequestBody ProcessListVo process) {
		ResultData resultData = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if((null != user)&&(StringUtils.isNotBlank(user.getId()))) {
				resultData = workFlowAntService.deleteApproveProcessBusiness(user, process);
				LOG.info("删除业务成功");
			}else {
				LOG.error("获取登录用户信息异常");
				resultData.setSuccess(false);
				resultData.setErrorMsg("获取登录用户信息异常");
			}
		} catch(Exception e) {
			LOG.error("删除业务异常", e);
			resultData.setSuccess(false);
			resultData.setErrorMsg("删除业务异常");
		}
		return resultData;
	}

}
